﻿// -----------------------------------------------------------------------
// <copyright file="Car.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Ex03.GarageLogic
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class Car : Vehicle 
    {
        private const int k_NumOfWheels = 4;
        private const float k_MaxAirPressure = 28;
        private const int k_FuelMotorCapacity = 55;
        private const float k_ElectricMotorCapacity = 2.5f;
        private eColor m_PaintColor;
        private eDoors m_NumOfDoors;

        public Car(EnergySource.eEnergySourceType i_EnergySourceType)
            : base(k_NumOfWheels, k_MaxAirPressure)
        {
            if (i_EnergySourceType == EnergySource.eEnergySourceType.Electricity)
            {
                this.m_EnergySource = new Electric();
                this.m_EnergySource.MaxEnergyCapacity = k_ElectricMotorCapacity;
            }
            else
            {
                this.m_EnergySource = new Fueled(EnergySource.eEnergySourceType.Octan98);
                this.m_EnergySource.MaxEnergyCapacity = k_FuelMotorCapacity;
            }
        }

        public override void UpdateVehicleDetails(List<string> i_VehicleDetails)
        {
            base.UpdateVehicleDetails(i_VehicleDetails);
            this.m_PaintColor = (eColor)Enum.Parse(typeof(eColor), i_VehicleDetails[5]);
            this.m_NumOfDoors = (eDoors)Enum.Parse(typeof(eDoors), i_VehicleDetails[6]);
        }

        public override List<string> ReturnSpecialFeatures()
        {
            List<string> featuresToReturn = new List<string>();
            featuresToReturn.Add("car color  - choose one of the following:" + System.Environment.NewLine + "1) Red " + System.Environment.NewLine + "2) Yellow " + System.Environment.NewLine + "3) Black " + System.Environment.NewLine + "4) Silver");
            featuresToReturn.Add("number of doors (2,3,4,5)");

            return featuresToReturn;
        }

        public override StringBuilder GetSpecialDataPrint()
        {
            StringBuilder specialDetails = new StringBuilder();
            specialDetails.Append("the car's color is: " + this.m_PaintColor.ToString() + System.Environment.NewLine);
            specialDetails.Append("the car's number of doors is: " + this.m_NumOfDoors.ToString() + System.Environment.NewLine);

            return specialDetails;
        }
    }

    public enum eColor
    {
        Red,
        Yellow,
        Black,
        Silver
    }

    public enum eDoors
    {
        Two,
        Three,
        Four,
        Five
    }
}
